<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>字符的大小写转换</title>
    <style>
        body{
            background-color: #F3EFE0;
        }
        .bot{
            color: #918E84;
            font-family:Arial, Helvetica, sans-serif;
            font-size: 24px;
            position: relative;
            right: 200px;
            float: right;
        }
    </style>
</head>
<body>
    <h1>字符的大小写转换</h1>
    原数据：<input id="old" type="text"><br><br>
    操&nbsp;&nbsp;&nbsp;作：  
        <input type="button" value="转大写" onclick="deal('upper')">
        <input type="button" value="转小写" onclick="deal('lower')">
        <input type="button" value="求长度" onclick="deal('len')"><br><br>
    新数据：<input id="new" type="text">
    <div class="bot">
        <input type="button" value="返回" onclick="location.href = '../章节目录/第四章.html'">
        <br><br><br><br><br><br><br><br>
        <h3>Please appreciate((●'◡'●))......</h3>
    </div>
    <script>
        function deal(opt){
            var str = document.getElementById('old').value;
            switch(opt){
                case 'upper':
                    str = str.toUpperCase();
                    break;
                case 'lower':
                    str = str.toLowerCase();
                    break;
                case 'len':
                    str = str.length;
            }
            document.getElementById('new').value = str;
        }
    </script>
</body>
</html>